#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    button = new QPushButton(this);
    button->setText("Button");
    button->setEnabled(false);
    connect(button, &QPushButton::clicked, this, &Widget::Hanlder);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::Hanlder()
{
    qDebug() << "Button 被点击";
}


void Widget::on_pushButton_clicked()
{
    qDebug() << "button 被点击";
}

void Widget::on_pushButton_2_clicked()
{
    if(ui->pushButton->isEnabled())
    {
        ui->pushButton->setEnabled(false);
    }
    else
    {
        ui->pushButton->setEnabled(true);
    }

    if(button->isEnabled())
    {
        button->setEnabled(false);
    }
    else
    {
        button->setEnabled(true);
    }
}
